package com.direct.web.action;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.StrutsStatics;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public abstract class BaseAction extends ActionSupport {
	
	public static final String LIST = "list";
	public static final String ADD = "add";
	public static final String UPDATE = "update";
	
	private ActionContext context = ActionContext.getContext();
	
	//获取request对象
	protected HttpServletRequest getRequest() {
		return (HttpServletRequest) context.get(StrutsStatics.HTTP_REQUEST);
	}
	//获取response对象
	protected HttpServletResponse getResponse() {
		return (HttpServletResponse) context.get(StrutsStatics.HTTP_RESPONSE);
	}
	//获取session对象
	protected HttpSession getHttpSession() {
		return getRequest().getSession();
	}

	protected Map<String,Object> getSession() {
		return context.getSession();
	}
	
	private int pn;
	private int pr;
	
	public int getPn() {
		return pn;
	}

	public void setPn(int pn) {
		this.pn = pn;
	}

	public int getPr() {
		return pr;
	}

	public void setPr(int pr) {
		this.pr = pr;
	}
}
